#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t = 0;
	int a, b, c;
	while(cin>>a>>b>>c)
	{
		t++;
		unordered_map<int, int> mp;
		
		vector<int> x(a), y(b), z(c);
		for(int i = 1;i <= a;i++)
			cin>>x[i-1];
		for(int i = 1;i <= b;i++)
			cin>>y[i-1];
		for(int i = 1;i <= c;i++)
			cin>>z[i-1];
		
		for(int i = 0;i < a;i++)
			for(int j = 0;j < b;j++)
					mp[x[i]+y[j]] = 1;
		
		int m, target;
		cin>>m;
		cout<<"Case "<<t<<":"<<endl;
		while(m--)
		{
			int flag = 0;
			cin>>target;
			for(int i = 0;i < c;i++)
			{
				if(mp.count(target-z[i]) != 0)
				{
					flag = 1;
					break;
				}
			}
			if(flag)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
		}
	}
	return 0;
}

